home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagg_m.zip / GRAPHICS.SWG / 0106_DOT Matrix LED Effect.pas < prev    next >
Pascal/Delphi Source File  |  1994-08-24  |  29KB  |  959 lines

  1. unit dotmat; {written by Iain Whyte. (c) 1994 }
  2.  
  3. { This unit generates a 'dot matrix' LED effect that is very effective. If
  4. you would like to use this code, all that I ask is that you mention it
  5. in the credits somewhere, and let me know what you used it for. If you have
  6. any suggestions, or you want to talk to me or ask questions, I can be
  7. contacted at whytei@topaz.ucq.edu.au or ba022@cq-pan.cqu.edu.au
  8. via the Internet, or by snail-post :
  9.  
  10.           Iain Whyte
  11.           141 Racecourse Road
  12.           Mt Morgan Q4714
  13.           Australia.
  14.  
  15. or on the Rockhampton Computer Club BBS, via the programming, IBM/DOS, or
  16. AMIGA conferences... RCC BBS: (079) 276200
  17.  
  18. Instructions :
  19.  
  20. Self explanatary, really, there is a sample prog for using this unit at the
  21. of this file..... }
  22.  
  23. {displays upto 10 characters at once, max string size (ATM) is 20 chars....}
  24.  
  25.  
  26. interface
  27.  
  28. uses dos,crt,graph;
  29.  
  30.  
  31.  
  32. procedure display_dotmat_screen(xpos,ypos:integer);
  33. procedure create_dotmat(inputstring:string);
  34. procedure straight_display;
  35. procedure left_right;
  36. procedure right_left;
  37. procedure top_bot;
  38. procedure bot_top;
  39. procedure italics;
  40. procedure random_fade_out;
  41. procedure random_fade_in;
  42. procedure fall_away;
  43.  
  44.  
  45.  
  46. implementation
  47.  
  48.  
  49. type
  50.  
  51. letter_set=array[0..8,0..4] of integer;
  52. dotmattype=array[0..8,0..119] of integer;
  53.  
  54. const
  55.      pixelsize = 2; {size of each LED element i.e. 2 therfore LED is 2x2 pixels}
  56.      a : letter_set = ((0,1,1,1,0),  {each letter is set up as a 5x9 array}
  57.                        (1,0,0,0,1),  {1 means LED is ON, 0 means LED OFF}
  58.                        (1,0,0,0,1),
  59.                        (1,0,0,0,1),
  60.                        (1,1,1,1,1),
  61.                        (1,0,0,0,1),
  62.                        (1,0,0,0,1),
  63.                        (1,0,0,0,1),
  64.                        (1,0,0,0,1));
  65.      b : letter_set = ((1,1,1,1,0),
  66.                        (1,0,0,0,1),
  67.                        (1,0,0,0,1),
  68.                        (1,0,0,0,1),
  69.                        (1,1,1,1,0),
  70.                        (1,0,0,0,1),
  71.                        (1,0,0,0,1),
  72.                        (1,0,0,0,1),
  73.                        (1,1,1,1,0));
  74.      c : letter_set = ((0,1,1,1,0),
  75.                        (1,0,0,0,1),
  76.                        (1,0,0,0,0),
  77.                        (1,0,0,0,0),
  78.                        (1,0,0,0,0),
  79.                        (1,0,0,0,0),
  80.                        (1,0,0,0,0),
  81.                        (1,0,0,0,1),
  82.                        (0,1,1,1,0));
  83.      d : letter_set = ((1,1,1,1,0),
  84.                        (1,0,0,0,1),
  85.                        (1,0,0,0,1),
  86.                        (1,0,0,0,1),
  87.                        (1,0,0,0,1),
  88.                        (1,0,0,0,1),
  89.                        (1,0,0,0,1),
  90.                        (1,0,0,0,1),
  91.                        (1,1,1,1,0));
  92.      e : letter_set = ((1,1,1,1,1),
  93.                        (1,0,0,0,0),
  94.                        (1,0,0,0,0),
  95.                        (1,0,0,0,0),
  96.                        (1,1,1,0,0),
  97.                        (1,0,0,0,0),
  98.                        (1,0,0,0,0),
  99.                        (1,0,0,0,0),
  100.                        (1,1,1,1,1));
  101.      f : letter_set = ((1,1,1,1,1),
  102.                        (1,0,0,0,0),
  103.                        (1,0,0,0,0),
  104.                        (1,0,0,0,0),
  105.                        (1,1,1,0,0),
  106.                        (1,0,0,0,0),
  107.                        (1,0,0,0,0),
  108.                        (1,0,0,0,0),
  109.                        (1,0,0,0,0));
  110.      g : letter_set = ((0,1,1,1,0),
  111.                        (1,0,0,0,1),
  112.                        (1,0,0,0,0),
  113.                        (1,0,0,0,0),
  114.                        (1,0,1,1,1),
  115.                        (1,0,0,0,1),
  116.                        (1,0,0,0,1),
  117.                        (1,0,0,0,1),
  118.                        (0,1,1,1,0));
  119.      h : letter_set = ((1,0,0,0,1),
  120.                        (1,0,0,0,1),
  121.                        (1,0,0,0,1),
  122.                        (1,0,0,0,1),
  123.                        (1,1,1,1,1),
  124.                        (1,0,0,0,1),
  125.                        (1,0,0,0,1),
  126.                        (1,0,0,0,1),
  127.                        (1,0,0,0,1));
  128.      i : letter_set = ((0,1,1,1,0),
  129.                        (0,0,1,0,0),
  130.                        (0,0,1,0,0),
  131.                        (0,0,1,0,0),
  132.                        (0,0,1,0,0),
  133.                        (0,0,1,0,0),
  134.                        (0,0,1,0,0),
  135.                        (0,0,1,0,0),
  136.                        (0,1,1,1,0));
  137.      j : letter_set = ((0,0,1,1,1),
  138.                        (0,0,0,1,0),
  139.                        (0,0,0,1,0),
  140.                        (0,0,0,1,0),
  141.                        (0,0,0,1,0),
  142.                        (1,0,0,1,0),
  143.                        (1,0,0,1,0),
  144.                        (1,0,0,1,0),
  145.                        (0,1,1,0,0));
  146.      k : letter_set = ((1,0,0,0,1),
  147.                        (1,0,0,1,0),
  148.                        (1,0,1,0,0),
  149.                        (1,1,0,0,0),
  150.                        (1,1,0,0,0),
  151.                        (1,1,0,0,0),
  152.                        (1,0,1,0,0),
  153.                        (1,0,0,1,0),
  154.                        (1,0,0,0,1));
  155.      l : letter_set = ((1,0,0,0,0),
  156.                        (1,0,0,0,0),
  157.                        (1,0,0,0,0),
  158.                        (1,0,0,0,0),
  159.                        (1,0,0,0,0),
  160.                        (1,0,0,0,0),
  161.                        (1,0,0,0,0),
  162.                        (1,0,0,0,0),
  163.                        (1,1,1,1,1));
  164.      m : letter_set = ((1,0,0,0,1),
  165.                        (1,1,0,1,1),
  166.                        (1,1,1,1,1),
  167.                        (1,0,1,0,1),
  168.                        (1,0,1,0,1),
  169.                        (1,0,0,0,1),
  170.                        (1,0,0,0,1),
  171.                        (1,0,0,0,1),
  172.                        (1,0,0,0,1));
  173.      n : letter_set = ((1,0,0,0,1),
  174.                        (1,1,0,0,1),
  175.                        (1,1,0,0,1),
  176.                        (1,0,1,0,1),
  177.                        (1,0,1,0,1),
  178.                        (1,0,1,0,1),
  179.                        (1,0,0,1,1),
  180.                        (1,0,0,1,1),
  181.                        (1,0,0,0,1));
  182.      o :  letter_set =((0,1,1,1,0),
  183.                        (1,0,0,0,1),
  184.                        (1,0,0,0,1),
  185.                        (1,0,0,0,1),
  186.                        (1,0,0,0,1),
  187.                        (1,0,0,0,1),
  188.                        (1,0,0,0,1),
  189.                        (1,0,0,0,1),
  190.                        (0,1,1,1,0));
  191.      p :  letter_set =((1,1,1,1,0),
  192.                        (1,0,0,0,1),
  193.                        (1,0,0,0,1),
  194.                        (1,0,0,0,1),
  195.                        (1,1,1,1,0),
  196.                        (1,0,0,0,0),
  197.                        (1,0,0,0,0),
  198.                        (1,0,0,0,0),
  199.                        (1,0,0,0,0));
  200.      q :  letter_set =((0,1,1,1,0),
  201.                        (1,0,0,0,1),
  202.                        (1,0,0,0,1),
  203.                        (1,0,0,0,1),
  204.                        (1,0,0,0,1),
  205.                        (1,0,0,0,1),
  206.                        (1,0,1,0,1),
  207.                        (1,0,0,1,1),
  208.                        (0,1,1,1,1));
  209.      r :  letter_set =((1,1,1,1,0),
  210.                        (1,0,0,0,1),
  211.                        (1,0,0,0,1),
  212.                        (1,0,0,0,1),
  213.                        (1,1,1,1,0),
  214.                        (1,1,0,0,0),
  215.                        (1,0,1,0,0),
  216.                        (1,0,0,1,0),
  217.                        (1,0,0,0,1));
  218.      s :  letter_set =((0,1,1,1,0),
  219.                        (1,0,0,0,1),
  220.                        (1,0,0,0,0),
  221.                        (1,0,0,0,0),
  222.                        (0,1,1,1,0),
  223.                        (0,0,0,0,1),
  224.                        (0,0,0,0,1),
  225.                        (1,0,0,0,1),
  226.                        (0,1,1,1,0));
  227.      t :  letter_set =((1,1,1,1,1),
  228.                        (0,0,1,0,0),
  229.                        (0,0,1,0,0),
  230.                        (0,0,1,0,0),
  231.                        (0,0,1,0,0),
  232.                        (0,0,1,0,0),
  233.                        (0,0,1,0,0),
  234.                        (0,0,1,0,0),
  235.                        (0,0,1,0,0));
  236.      u :  letter_set =((1,0,0,0,1),
  237.                        (1,0,0,0,1),
  238.                        (1,0,0,0,1),
  239.                        (1,0,0,0,1),
  240.                        (1,0,0,0,1),
  241.                        (1,0,0,0,1),
  242.                        (1,0,0,0,1),
  243.                        (1,0,0,0,1),
  244.                        (0,1,1,1,0));
  245.      v :  letter_set =((1,0,0,0,1),
  246.                        (1,0,0,0,1),
  247.                        (1,0,0,0,1),
  248.                        (1,0,0,0,1),
  249.                        (1,0,0,0,1),
  250.                        (1,0,0,0,1),
  251.                        (0,1,0,1,0),
  252.                        (0,1,0,1,0),
  253.                        (0,0,1,0,0));
  254.      w :  letter_set =((1,0,0,0,1),
  255.                        (1,0,0,0,1),
  256.                        (1,0,0,0,1),
  257.                        (1,0,0,0,1),
  258.                        (1,0,0,0,1),
  259.                        (1,0,1,0,1),
  260.                        (1,0,1,0,1),
  261.                        (0,1,1,1,0),
  262.                        (0,1,0,1,0));
  263.      x :  letter_set =((1,0,0,0,1),
  264.                        (1,0,0,0,1),
  265.                        (1,0,0,0,1),
  266.                        (0,1,0,1,0),
  267.                        (0,0,1,0,0),
  268.                        (0,1,0,1,0),
  269.                        (1,0,0,0,1),
  270.                        (1,0,0,0,1),
  271.                        (1,0,0,0,1));
  272.      y :  letter_set =((1,0,0,0,1),
  273.                        (1,0,0,0,1),
  274.                        (1,0,0,0,1),
  275.                        (0,1,0,1,0),
  276.                        (0,0,1,0,0),
  277.                        (0,0,1,0,0),
  278.                        (0,0,1,0,0),
  279.                        (0,0,1,0,0),
  280.                        (0,0,1,0,0));
  281.      z :  letter_set =((1,1,1,1,1),
  282.                        (0,0,0,0,1),
  283.                        (0,0,0,0,1),
  284.                        (0,0,0,1,0),
  285.                        (0,0,1,0,0),
  286.                        (0,1,0,0,0),
  287.                        (1,0,0,0,0),
  288.                        (1,0,0,0,0),
  289.                        (1,1,1,1,1));
  290.      exc :  letter_set =((0,0,1,0,0),
  291.                        (0,1,1,1,0),
  292.                        (0,1,1,1,0),
  293.                        (0,1,1,1,0),
  294.                        (0,1,1,1,0),
  295.                        (0,0,1,0,0),
  296.                        (0,0,1,0,0),
  297.                        (0,0,0,0,0),
  298.                        (0,0,1,0,0));
  299.      andm :  letter_set =((0,0,1,1,0),
  300.                        (0,1,0,0,1),
  301.                        (0,0,1,1,0),
  302.                        (0,1,1,1,0),
  303.                        (1,0,0,1,0),
  304.                        (1,0,0,0,1),
  305.                        (1,0,0,1,1),
  306.                        (1,0,0,1,0),
  307.                        (0,1,1,0,1));
  308.      hat :  letter_set =((0,1,0,1,0),
  309.                        (0,1,0,1,0),
  310.                        (1,1,1,1,1),
  311.                        (0,1,0,1,0),
  312.                        (0,1,0,1,0),
  313.                        (1,1,1,1,1),
  314.                        (0,1,0,1,0),
  315.                        (0,1,0,1,0),
  316.                        (0,1,0,1,0));
  317.      com :  letter_set =((0,0,0,0,0),
  318.                        (0,0,0,0,0),
  319.                        (0,0,0,0,0),
  320.                        (0,0,0,0,0),
  321.                        (0,0,0,0,0),
  322.                        (0,0,1,1,0),
  323.                        (0,0,1,1,0),
  324.                        (0,0,1,0,0),
  325.                        (0,1,1,0,0));
  326.      ast : letter_set=((0,0,0,0,0),
  327.                        (1,0,1,0,1),
  328.                        (0,1,1,1,0),
  329.                        (0,0,1,0,0),
  330.                        (1,1,1,1,1),
  331.                        (0,0,1,0,0),
  332.                        (0,1,1,1,0),
  333.                        (1,0,1,0,1),
  334.                        (0,0,0,0,0));
  335.      la : letter_set =((0,0,0,0,1),
  336.                        (0,0,0,1,0),
  337.                        (0,0,1,0,0),
  338.                        (0,1,0,0,0),
  339.                        (1,0,0,0,0),
  340.                        (0,1,0,0,0),
  341.                        (0,0,1,0,0),
  342.                        (0,0,0,1,0),
  343.                        (0,0,0,0,1));
  344.      ra : letter_set =((1,0,0,0,0),
  345.                        (0,1,0,0,0),
  346.                        (0,0,1,0,0),
  347.                        (0,0,0,1,0),
  348.                        (0,0,0,0,1),
  349.                        (0,0,0,1,0),
  350.                        (0,0,1,0,0),
  351.                        (0,1,0,0,0),
  352.                        (1,0,0,0,0));
  353.      one :letter_set =((0,0,1,0,0),
  354.                        (0,1,1,0,0),
  355.                        (0,0,1,0,0),
  356.                        (0,0,1,0,0),
  357.                        (0,0,1,0,0),
  358.                        (0,0,1,0,0),
  359.                        (0,0,1,0,0),
  360.                        (0,0,1,0,0),
  361.                        (0,1,1,1,0));
  362.      two : letter_set=((0,1,1,1,0),
  363.                        (1,0,0,0,1),
  364.                        (0,0,0,0,1),
  365.                        (0,0,0,1,0),
  366.                        (0,0,1,0,0),
  367.                        (0,1,0,0,0),
  368.                        (1,0,0,0,0),
  369.                        (1,0,0,0,0),
  370.                        (1,1,1,1,1));
  371.      thr: letter_set =((0,1,1,1,0),
  372.                        (1,0,0,0,1),
  373.                        (0,0,0,0,1),
  374.                        (0,0,0,0,1),
  375.                        (0,0,1,1,0),
  376.                        (0,0,0,0,1),
  377.                        (0,0,0,0,1),
  378.                        (1,0,0,0,1),
  379.                        (0,1,1,1,0));
  380.      four:letter_set =((1,0,0,0,0),
  381.                        (1,0,0,0,0),
  382.                        (1,0,0,1,0),
  383.                        (1,0,0,1,0),
  384.                        (1,0,0,1,0),
  385.                        (1,0,0,1,0),
  386.                        (1,1,1,1,1),
  387.                        (0,0,0,1,0),
  388.                        (0,0,0,1,0));
  389.      five:letter_set =((1,1,1,1,1),
  390.                        (1,0,0,0,0),
  391.                        (1,0,0,0,0),
  392.                        (1,1,1,1,0),
  393.                        (1,0,0,0,1),
  394.                        (0,0,0,0,1),
  395.                        (0,0,0,0,1),
  396.                        (1,0,0,0,1),
  397.                        (0,1,1,1,0));
  398.      six :letter_set =((0,1,1,1,0),
  399.                        (1,0,0,0,1),
  400.                        (1,0,0,0,0),
  401.                        (1,1,1,1,0),
  402.                        (1,0,0,0,1),
  403.                        (1,0,0,0,1),
  404.                        (1,0,0,0,1),
  405.                        (1,0,0,0,1),
  406.                        (0,1,1,1,0));
  407.      sev :letter_set =((1,1,1,1,1),
  408.                        (1,0,0,0,1),
  409.                        (0,0,0,0,1),
  410.                        (0,0,0,1,0),
  411.                        (0,0,0,1,0),
  412.                        (0,0,1,0,0),
  413.                        (0,0,1,0,0),
  414.                        (0,1,0,0,0),
  415.                        (0,1,0,0,0));
  416.     eight:letter_set =((0,1,1,1,0),
  417.                        (1,0,0,0,1),
  418.                        (1,0,0,0,1),
  419.                        (1,0,0,0,1),
  420.                        (0,1,1,1,0),
  421.                        (1,0,0,0,1),
  422.                        (1,0,0,0,1),
  423.                        (1,0,0,0,1),
  424.                        (0,1,1,1,0));
  425.    nine : letter_set =((0,1,1,1,0),
  426.                        (1,0,0,0,1),
  427.                        (1,0,0,0,1),
  428.                        (1,0,0,0,1),
  429.                        (1,0,0,0,1),
  430.                        (0,1,1,1,1),
  431.                        (0,0,0,0,1),
  432.                        (1,0,0,0,1),
  433.                        (0,1,1,1,0));
  434.    zer  : letter_set =((0,1,1,1,0),
  435.                        (1,0,0,1,1),
  436.                        (1,0,0,1,1),
  437.                        (1,0,1,0,1),
  438.                        (1,0,1,0,1),
  439.                        (1,0,1,0,1),
  440.                        (1,1,0,0,1),
  441.                        (1,1,0,0,1),
  442.                        (0,1,1,1,0));
  443.  
  444.    smil  :letter_set =((0,1,1,1,0),
  445.                        (1,1,1,1,1),
  446.                        (1,0,1,0,1),
  447.                        (1,1,1,1,1),
  448.                        (1,1,0,1,1),
  449.                        (1,1,1,1,1),
  450.                        (1,0,0,0,1),
  451.                        (1,1,0,1,1),
  452.                        (0,1,1,1,0));
  453.    dol :  letter_set =((0,0,1,0,0),
  454.                        (0,1,1,1,0),
  455.                        (1,0,1,0,1),
  456.                        (1,0,1,0,0),
  457.                        (0,1,1,1,0),
  458.                        (0,0,1,0,1),
  459.                        (1,0,1,0,1),
  460.                        (0,1,1,1,0),
  461.                        (0,0,1,0,0));
  462.    copyr: letter_set =((0,1,1,1,0),
  463.                        (1,0,0,0,1),
  464.                        (1,0,1,0,1),
  465.                        (1,1,0,1,1),
  466.                        (1,1,0,0,1),
  467.                        (1,1,0,1,1),
  468.                        (1,0,1,0,1),
  469.                        (1,0,0,0,1),
  470.                        (0,1,1,1,0));
  471.    lb:    letter_set =((0,0,0,1,0),
  472.                        (0,0,1,0,0),
  473.                        (0,0,1,0,0),
  474.                        (0,1,0,0,0),
  475.                        (0,1,0,0,0),
  476.                        (0,1,0,0,0),
  477.                        (0,0,1,0,0),
  478.                        (0,0,1,0,0),
  479.                        (0,0,0,1,0));
  480.    rb:    letter_set =((0,1,0,0,0),
  481.                        (0,0,1,0,0),
  482.                        (0,0,1,0,0),
  483.                        (0,0,0,1,0),
  484.                        (0,0,0,1,0),
  485.                        (0,0,0,1,0),
  486.                        (0,0,1,0,0),
  487.                        (0,0,1,0,0),
  488.                        (0,1,0,0,0));
  489.    quest: letter_set =((0,1,1,1,0),
  490.                        (1,0,0,0,1),
  491.                        (0,0,0,0,1),
  492.                        (0,0,0,1,0),
  493.                        (0,0,0,1,0),
  494.                        (0,0,1,0,0),
  495.                        (0,0,1,0,0),
  496.                        (0,0,0,0,0),
  497.                        (0,0,1,0,0));
  498.  
  499.  
  500. var
  501.   letters:array[' '..'z']of letter_set;
  502.   outchars:array[0..19]of char;
  503.   mainxpos,mainypos:integer;
  504.   dotmatarray:dotmattype;
  505.   dotmatarraymove,dotmatempty:dotmattype;
  506.   counth,countv,lettercount:integer;
  507.   count,count2,countmove,countloop:integer;
  508.  
  509. procedure setup_chars;
  510.  
  511. begin
  512.      letters['a']:=a;
  513.      letters['b']:=b;
  514.      letters['c']:=c;
  515.      letters['d']:=d;
  516.      letters['e']:=e;
  517.      letters['f']:=f;
  518.      letters['g']:=g;
  519.      letters['h']:=h;
  520.      letters['i']:=i;
  521.      letters['j']:=j;
  522.      letters['k']:=k;
  523.      letters['l']:=l;
  524.      letters['m']:=m;
  525.      letters['n']:=n;
  526.      letters['o']:=o;
  527.      letters['p']:=p;
  528.      letters['q']:=q;
  529.      letters['r']:=r;
  530.      letters['s']:=s;
  531.      letters['t']:=t;
  532.      letters['u']:=u;
  533.      letters['v']:=v;
  534.      letters['w']:=w;
  535.      letters['x']:=x;
  536.      letters['y']:=y;
  537.      letters['z']:=z;
  538.      letters['!']:=exc;
  539.      letters['&']:=andm;
  540.      letters['#']:=hat;
  541.      letters[',']:=com;
  542.      letters['*']:=ast;
  543.      letters['<']:=la;
  544.      letters['>']:=ra;
  545.      letters['1']:=one;
  546.      letters['2']:=two;
  547.      letters['3']:=thr;
  548.      letters['4']:=four;
  549.      letters['5']:=five;
  550.      letters['6']:=six;
  551.      letters['7']:=sev;
  552.      letters['8']:=eight;
  553.      letters['9']:=nine;
  554.      letters['0']:=zer;
  555.      letters['^']:=smil;
  556.      letters['$']:=dol;
  557.      letters['@']:=copyr;
  558.      letters['(']:=lb;
  559.      letters[')']:=rb;
  560.      letters['?']:=quest;
  561. end;
  562.  
  563. procedure display_dotmat_screen(xpos,ypos:integer);
  564.  
  565. var countx,county:integer;
  566.  
  567. begin
  568.      mainxpos:=xpos;
  569.      mainypos:=ypos;
  570.      setfillstyle(1,8);
  571.      for countx:=0 to 59 do
  572.      begin
  573.           for county:=-1 to 9 do
  574.           begin
  575.                bar((xpos+(countx*(pixelsize+1))),(ypos+(county*(pixelsize+1))),
  576.                   ((xpos+(countx*(pixelsize+1)))+(pixelsize-1)),((ypos+(county*(pixelsize+1)))+(pixelsize-1)));
  577.  
  578.           end;
  579.      end;
  580. end;
  581.  
  582.  
  583. procedure convertstring_to_chars(instr:string);
  584.  
  585. var count:integer;
  586.     dummys:string[1];
  587.     strcount:char;
  588.  
  589. begin
  590.      for count:=1 to 20 do
  591.      begin
  592.  
  593.           dummys:=copy(instr,count,1);
  594.           for strcount:=' ' to 'z' do
  595.           begin
  596.                if dummys = strcount then outchars[count-1]:=strcount;
  597.           end;
  598.      end;
  599. end;
  600.  
  601.  
  602. procedure create_dotmat(inputstring:string);
  603.  
  604. begin
  605.      for countv:=0 to 8 do
  606.      for counth:=0 to 119 do
  607.      dotmatempty[countv,counth]:=0;
  608.  
  609.      setup_chars;
  610.      convertstring_to_chars(inputstring);
  611.  
  612.      for lettercount:=0 to 19 do  {make array of dots from letter data}
  613.      begin
  614.  
  615.      for countv:=0 to 8 do
  616.      begin
  617.  
  618.           for counth :=(lettercount*6) to ((lettercount*6)+6) do
  619.           begin
  620.               if counth<120 then
  621.               begin
  622.               dotmatarray[countv,counth]:=letters[outchars[lettercount],countv,(counth-lettercount*6)];
  623.               if (counth-lettercount*6) > 4 then dotmatarray[countv,counth]:=0;
  624.               end;
  625.           end;
  626.      end;
  627.      end;
  628.  
  629.  
  630.  
  631. end;
  632.  
  633.  
  634. procedure gen_display;
  635.  
  636. begin
  637.  
  638.      for counth:=0 to 59 do
  639.      begin
  640.           for countv:=0 to 8 do
  641.           begin
  642.                if (counth < 2) or (counth > 57) then setfillstyle(1,2)
  643.                else setfillstyle(1,10);
  644.                if dotmatarraymove[countv,counth] = 1 then
  645.                begin
  646.                   bar((mainxpos+(counth*(pixelsize+1))),(mainypos+(countv*(pixelsize+1))),
  647.                   ((mainxpos+(counth*(pixelsize+1)))+(pixelsize-1)),((mainypos+(countv*(pixelsize+1)))+(pixelsize-1)));
  648.                end;
  649.                setfillstyle(1,8);
  650.                if dotmatarraymove[countv,counth] = 0 then
  651.                begin
  652.                    bar((mainxpos+(counth*(pixelsize+1))),(mainypos+(countv*(pixelsize+1))),
  653.                   ((mainxpos+(counth*(pixelsize+1)))+(pixelsize-1)),((mainypos+(countv*(pixelsize+1)))+(pixelsize-1)));
  654.                end;
  655.           end;
  656.      end;
  657.  
  658. end;
  659.  
  660.  
  661. procedure straight_display;
  662.  
  663. begin
  664.      dotmatarraymove:=dotmatarray;
  665.      gen_display;
  666. end;
  667.  
  668.  
  669.  
  670. procedure left_right;
  671. begin
  672.  
  673.      for count2:=0 to 119 do
  674.      begin
  675.           for count:=0 to 59 do
  676.           begin
  677.           countmove:=count+count2;
  678.           if countmove>119 then countmove:=countmove-120;
  679.           for countloop:=0 to 8 do dotmatarraymove[countloop,count]:=dotmatarray[countloop,countmove];
  680.  
  681.           end;
  682.      gen_display;
  683.      delay(5);
  684.      end;
  685. end;
  686.  
  687.  
  688. procedure right_left;
  689. begin
  690.  
  691.      for count2:=119 downto 0 do
  692.      begin
  693.  
  694.           for count:=0 to 59 do
  695.           begin
  696.           countmove:=count+count2;
  697.           if countmove>119 then countmove:=countmove-120;
  698.           for countloop:= 0 to 8 do dotmatarraymove[countloop,count]:=dotmatarray[countloop,countmove];
  699.  
  700.           end;
  701.  
  702.      gen_display;
  703.      delay(5);
  704.      end;
  705. end;
  706.  
  707.  
  708. procedure top_bot;
  709. begin
  710.      dotmatarraymove:=dotmatempty;
  711.      for count2:=-9 to 9 do
  712.      begin
  713.  
  714.           for count:=0 to 8 do
  715.           begin
  716.             countmove:=count+count2;
  717.           if countmove>8 then for countloop:=0 to 119 do dotmatarraymove[count,countloop]:=0
  718.           else if countmove<0 then for countloop:=0 to 119 do dotmatarraymove[count,countloop]:=0
  719.           else for countloop:=0 to 119 do dotmatarraymove[count,countloop]:=dotmatarray[countmove,countloop];
  720.  
  721.           end;
  722.  
  723.      gen_display;
  724.      delay(50);
  725.      end;
  726. end;
  727.  
  728.  
  729. procedure bot_top;
  730. begin
  731.      for count2:=9 downto -9 do
  732.      begin
  733.  
  734.           for count:=0 to 8 do
  735.           begin
  736.             countmove:=count+count2;
  737.            if countmove>8 then for countloop:=0 to 119 do dotmatarraymove[count,countloop]:=0
  738.           else if countmove<0 then for countloop:=0 to 119 do dotmatarraymove[count,countloop]:=0
  739.           else for countloop:=0 to 119 do dotmatarraymove[count,countloop]:=dotmatarray[countmove,countloop];
  740.  
  741.  
  742.  
  743.           end;
  744.  
  745.      gen_display;
  746.      delay(50);
  747.      end;
  748.  
  749.  
  750. end;
  751.  
  752. procedure italics;
  753. begin
  754.      for count:=0 to 8 do
  755.      begin
  756.           for count2:=0 to 119 do
  757.           begin
  758.                if (count mod 2) = 0 then
  759.                begin
  760.                     dotmatarraymove[count,count2]:=dotmatarray[count,count2+(count div 2)];
  761.                end else
  762.                     dotmatarraymove[count,count2]:=dotmatarray[count,count2+((count-1) div 2)];
  763.           end;
  764.      end;
  765.      dotmatarray:=dotmatarraymove;
  766. end;
  767.  
  768.  
  769.  
  770. procedure random_fade_out;
  771.  
  772. var
  773. v,h,rnd,countdots:integer;
  774.  
  775. begin
  776.      randomize;
  777.      dotmatarraymove:=dotmatarray;
  778.      countdots:=0;
  779.      for v:=0 to 8 do
  780.      begin
  781.      for h:=0 to 119 do
  782.      begin
  783.          if dotmatarraymove[v,h]=1 then
  784.  
  785.          countdots:=countdots+1;
  786.      end;
  787.      end;
  788.      repeat
  789.      for v:=0 to 8 do
  790.      begin
  791.      for h:=0 to 119 do
  792.      begin
  793.          if dotmatarraymove[v,h]=1 then
  794.          begin
  795.               rnd:=random(5);
  796.               if rnd = 1 then
  797.               begin
  798.                    countdots:=countdots-1;
  799.                    dotmatarraymove[v,h]:=0;
  800.               end;
  801.          end;
  802.      end;
  803.      end;
  804.  
  805.      gen_display;
  806.      until countdots<=0;
  807.  
  808. end;
  809.  
  810.  
  811. procedure random_fade_in;
  812. var
  813. v,h,rnd,countdots:integer;
  814. begin
  815.      randomize;
  816.      dotmatarraymove:=dotmatempty;
  817.      countdots:=0;
  818.      for v:=0 to 8 do
  819.      begin
  820.      for h:=0 to 119 do
  821.      begin
  822.          if dotmatarray[v,h]=1 then
  823.  
  824.          countdots:=countdots+1;
  825.      end;
  826.      end;
  827.      repeat
  828.      for v:=0 to 8 do
  829.      begin
  830.      for h:=0 to 119 do
  831.      begin
  832.          if (dotmatarray[v,h]=1)and (dotmatarraymove[v,h]=0) then
  833.          begin
  834.               rnd:=random(5);
  835.               if rnd = 1 then
  836.               begin
  837.                    countdots:=countdots-1;
  838.                    dotmatarraymove[v,h]:=1;
  839.               end;
  840.          end;
  841.      end;
  842.      end;
  843.  
  844.      gen_display;
  845.      until countdots<=0;
  846.  
  847. end;
  848.  
  849. procedure fall_away;
  850. begin
  851.      dotmatarraymove:=dotmatarray;
  852.      for count:=8 downto 0 do
  853.      begin
  854.          count2:=count;
  855.          repeat
  856.               for countloop:=0 to 119 do
  857.               begin
  858.                    if count2=count then
  859.                    begin
  860.                    dotmatarraymove[count2,countloop]:=dotmatarray[count,countloop];
  861.                    end
  862.                    else
  863.                    begin
  864.                    dotmatarraymove[count2,countloop]:=dotmatarray[count,countloop];
  865.                    dotmatarraymove[count2-1,countloop]:=0;
  866.                    end;
  867.               end;
  868.             gen_display;
  869.             delay(5);
  870.          count2:=count2+1;
  871.          until count2=10;
  872.  
  873.      end;
  874. end;
  875.  
  876.  
  877. end.
  878.  
  879. {-------------------------------  DEMO  ----------------------------------}
  880. program test_dotmat_unit;
  881.  
  882. uses dos,crt,graph,dotmat;
  883.  
  884.  
  885.  
  886. var
  887.    in1,in2:integer;
  888.  
  889.  
  890. begin              {12345678901234567890}  {length guide}
  891.  
  892.      initgraph(in1,in2,'c:\bp\bgi');  {initialise 640x480x16c mode bgi}
  893.      cleardevice;
  894.  
  895.  
  896.      display_dotmat_screen(50,50);    {set_up, display blank LED matrix}
  897.  
  898.      create_dotmat('this is a demo !    '); {loads string into matrix array}
  899.  
  900.      straight_display;       {display on matrix}
  901.      delay(1000);
  902.  
  903.  
  904.      left_right;             {scroll from left to right}
  905.      delay(1000);
  906.  
  907.      right_left;             {scroll from right to left}
  908.  
  909.      create_dotmat('fading in!           ');  {set up new msg}
  910.      random_fade_in;                          {randomised fade}
  911.      delay(1000);
  912.  
  913.      create_dotmat('fade out!!           ');
  914.      straight_display;
  915.      delay(1000);
  916.  
  917.      random_fade_out;
  918.  
  919.  
  920.      create_dotmat('can scroll 4 ways!!! ');
  921.      left_right;
  922.      top_bot;       {scroll from top to bottom}
  923.      right_left;
  924.      bot_top;       {scroll from bottom to top}
  925.  
  926.  
  927.      create_dotmat('italics for the font!'); {create new msg}
  928.      italics;                                {generate italics}
  929.      random_fade_in;
  930.      left_right;
  931.      delay(1000);
  932.      random_fade_out;
  933.  
  934.      create_dotmat('and a special effect ');  {create new msg}
  935.      left_right;
  936.      delay(1000);
  937.      create_dotmat('called fall away!    ');
  938.      left_right;
  939.      delay(1000);
  940.      fall_away;                               {demo Special FX}
  941.  
  942.      create_dotmat('well, what dya think?');
  943.      left_right;
  944.      fall_away;
  945.  
  946.      create_dotmat('@ iain whyte 1994    ');
  947.      random_fade_in;
  948.      left_right;
  949.      right_left;
  950.      random_fade_out;
  951.      top_bot;
  952.      bot_top;
  953.  
  954.  
  955.  
  956.      closegraph;                                    {kill graphics mode}
  957.  
  958. end.
  959.